package com.auxgroup.hr.front.service.process.impl;

import java.util.List;

import com.auxgroup.hr.front.service.process.WfDmcHdrService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsCWfDmcHdr;
import com.auxgroup.hr.front.dao.repository.PsCWfDmcHdrRepository;

/** 
 * @author wangchangyun
 * @version 创建时间：180601 
 * 社保公积金service
 */
@Service("wfDmcHdrService")
public class WfDmcHdrServiceImpl implements WfDmcHdrService {
	private static final Logger logger = LoggerFactory.getLogger(WfDmcHdrServiceImpl.class);
	
	@Autowired
	private PsCWfDmcHdrRepository PsCWfDmcHdrRepository;


	@Override
	public PsCWfDmcHdr getWfDmcHdr(String id) {
		return PsCWfDmcHdrRepository.findOne(id);
	}


	@Override
	public PsCWfDmcHdr save(PsCWfDmcHdr WfDmcHdr) {
		return PsCWfDmcHdrRepository.save(WfDmcHdr);
	}


	@Override
	public Boolean delete(String id) {
		try {
			PsCWfDmcHdrRepository.delete(id);
		} catch (Exception e) {
			logger.error("delete WfDmcHdr error: id={}",id,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCWfDmcHdr> getAll(String emplId) {
		PsCWfDmcHdr WfDmcHdr = new PsCWfDmcHdr();
		WfDmcHdr.setEmplid(emplId);
		return PsCWfDmcHdrRepository.findAll(Example.of(WfDmcHdr));
	}


	
	
	
}
